package utils;

import javax.swing.*;
import java.awt.*;

public class Tools {

    //窗口实现居中
    public static void setPos(JFrame jFrame,int width,int height){
        Toolkit tk = Toolkit.getDefaultToolkit();
        Dimension screenSize = tk.getScreenSize();
        //屏幕中心
        int x = (int)screenSize.getWidth()/2 - width/2;
        int y = (int)screenSize.getHeight()/2 - height/2;
        jFrame.setBounds(x,y,width,height);
    }
}
